<template>
  <div class="new-hot">
    <div class="webheart">
      <div class="button-cut">
        <el-row :gutter="20">
          <el-col
            :span="8"
            v-for="v in buttonList"
            :key="v.id"
            @click.native="handleClick(v)"
          >
            <div :class="['cut', { active: active == v.id }]">
              <i :class="['iconfont', v.iconName]"></i>
              <span>{{ v.title }}</span>
            </div>
          </el-col>
        </el-row>
      </div>
      <div class="totle">
        <p>>> 共 {{ totle }} 条数据 &lt;&lt;</p>
      </div>
    </div>
  </div>
</template>
<script>
import { NEWANDHOTS } from '@/utils/config'
export default {
  data() {
    return {
      active: '1',
      buttonList: [],
    }
  },
  props: {
    totle: {
      type: Number | String,
      default: 0,
    },
  },
  mounted() {
    this.buttonList = NEWANDHOTS
  },
  methods: {
    handleClick(v) {
      this.active = v.id
      this.$emit('e-newAndHot', v.id)
    },
  },
}
</script>
<style scoped lang="scss">
.new-hot {
  width: 100%;
  height: 42px;
  margin: 20px 0;
  background: url('~@/assets/specialty/line01.png') no-repeat center;
  .webheart {
    position: relative;
  }
  .button-cut {
    position: absolute;
    left: 0;
    top: 0;
    width: 355px;
    .cut {
      width: 100%;
      height: 42px;
      line-height: 42px;
      text-align: center;
      color: #333;
      font-size: 16px;
      border-radius: 42px;
      cursor: pointer;
      overflow: hidden;
      border: 1px solid #bebebe;
      span {
        float: left;
        line-height: 42px;
      }
      i {
        float: left;
        color: #999;
        font-size: 22px;
        margin-left: 20px;
        margin-right: 5px;
      }
    }
    .active {
      color: #fff;
      background-color: var(--colorH1);
      border-color: var(--colorH1);
      i {
        color: #fff;
      }
    }
  }
  .totle {
    position: absolute;
    right: -10px;
    top: 0;
    width: 160px;
    height: 42px;
    text-align: center;
    font-size: 14px;
    color: #333;
    line-height: 42px;
  }
}
@media screen and (max-width: 1400px) {
  .new-hot {
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
    background: none;
  }
}
</style>